<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        html {
            height: 100%;
            width: 100%;
        }

        body {
            display: flex;
            justify-content: center;
            align-items: center;
            height: 100%;
            width: 100%;

        }

        .qq {
            border: 1px solid #000;
        }

        .box {
            width: 700px;
            height: 600px;
            display: flex;
            flex-wrap: wrap;
        }

        .box div {
            display: inline-block;
            margin: 30px;
            width: 130px;
            height: 130px;
        }

        h1 {
            position: absolute;
            top: 0;
            margin-right: 100px;
            font-size: 80px;
        }

        .liuyifei {
            background-image: url(./imgs/01.png.webp);
            background-size: cover;
            border-radius: 50%
        }

        .zailaiyici {
            background-image: url(./imgs/05.png.webp);
            background-size: cover;
            border-radius: 50%;


        }

        .liushishi {
            background-image: url(./imgs/02.png.png);
            background-size: cover;
            border-radius: 50%
        }

        .bailu {
            background-image: url(./imgs/04.png.png);
            background-size: cover;
            border-radius: 50%
        }

        .fanpaizi {
            background-image: url(./imgs/05.png.png);
            background-size: cover;
            border-radius: 50%
        }

        .fanpaizi {
            background-image: url(./imgs/03.png.png);
            background-size: cover;
            border-radius: 50%
        }

        .jialing {
            background-image: url(./imgs/06.png.png);
            background-size: cover;
            border-radius: 50%
        }

        .lixueqin {
            background-image: url(./imgs/07.png.png);
            background-size: cover;
            border-radius: 50%
        }

        .yangmi {
            background-image: url(./imgs/08.png.png);
            background-size: cover;
            border-radius: 50%
        }

        .xuezhiqian {
            background-image: url(./imgs/09.png.webp);
            background-size: cover;
            border-radius: 50%;
            text-align: center;
        }

        span {
            display: none;
            background-color: red;
            text-align: center;
            color: #fff;
            display: inline-block;
            width: 50px;
            display: none;
        }
    </style>
</head>

<body>
    <h1>为中华崛起而读书</h1>
    <div class="box">
        <div class="beauty liuyifei"> <span>是我</span></div>
        <div class="beauty zailaiyici"><span>是我</span></div>
        <div class="beauty liushishi"><span>是我</span></div>
        <div class="beauty bailu"><span>是我</span></div>
        <div class="btn fanpaizi"></div>
        <div class="beauty jialing"><span>是我</span></div>
        <div class="beauty lixueqin"><span>是我</span></div>
        <div class="beauty yangmi"><span>是我</span></div>
        <div class="beauty xuezhiqian"><span>是我</span></div>

    </div>
    <script>
        let divs = document.querySelectorAll(".beauty")
        let btn = document.querySelector(".btn")
        let span = document.querySelectorAll("span")
        let h1 = document.querySelector("h1")
        btn.addEventListener("click", function () {
            choujiang(100)
        })
        let w = 0
        function choujiang(t) {

            let timer = setInterval(function () {
                let q = Math.floor(Math.random() * 8)
                console.log(q);
                span[q].classList.add("qq")
                span[q].style.display = "block"
                if (t == 300) {
                    h1.innerHTML = "爱妃，你好"
                    h1.style.color = "red"
                }

                span[w].classList.remove("qq")
                span[w].style.display = "none"

                w = q
                t = t + 50
                clearInterval(timer)
                if (t < 1000) {
                    choujiang(t)
                }
                if (t == 750) {

                    h1.innerHTML = "来源码，敲代码"
                    h1.style.color = "red"

                }
                if (t == 1000) {

                    h1.innerHTML = "为中华崛起而读书"
                    h1.style.color = "#000"

                }
                console.log(t);
            }, t)










        }
    </script>

</body>

</html>